var Form = function(opts) {
	if (Ext.isString(opts)) {
		opts = Ext.decode(opts);
	}
	if (!opts.fields || opts.fields.length == 0) {
		opts.hidden = true;
	}
	this.createSingleColumnForm = function(opts) {
		var items = [];
		Ext.each(opts.fields, function(field) {
					if (Ext.isString(field)) {
						field = Ext.decode(field);
					}
					if (field.data && Ext.isString(field.data)) {
						field.data = Ext.decode(field.data);
					}
					items.push(new Field(field));
				});
		return new Ext.form.FormPanel(Ext.apply({
					// padding : 5,
					labelWidth : opts.labelWidth || 70,
					labelAlign : 'right',
					defaults : {
						anchor : '100%'
					},
					items : items
				}, opts));
	};
	this.createMultiColumnForm = function(opts) {
		var items = [], hideItems = [];
		Ext.each(opts.fields, function(field) {
					if (field.hidden) {
						hideItems.push(new Ext.form.Hidden(field));
					} else {
						items.push({
									items : [Field(field)]
								});
					}
				});
		items.push({
					items : hideItems
				});
		return new Ext.form.FormPanel(Ext.apply({
					layout : 'table',
					padding : 5,
					defaults : {
						xtype : 'container',
						layout : 'form',
						width : opts.columnWidth || 380,
						labelWidth : opts.labelWidth || 70,
						labelAlign : 'right',
						defaults : {
							margins : '0 5 0 0',
							anchor : '100%'
						}
					},
					layoutConfig : {
						tableAttrs : {},
						columns : opts.columns
					},
					items : items
				}, opts));
	};
	if (opts.columns && opts.columns > 0) {
		return this.createMultiColumnForm(opts);
	}
	return this.createSingleColumnForm(opts);
};